import time

from selenium.webdriver.common.by import By

from Base import Base


class Page(Base):
    loc_username=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[1]/div/input')
    def username(self,username):
        self.send_keys(self.loc_username,username)
    loc_password=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/div[2]/div/input')
    def password(self,password):
        self.send_keys(self.loc_password,password)
    loc_login=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/div[2]/button[2]')
    def login(self):
        self.click(self.loc_login)
    loc_que=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[2]/div/div/div/div[2]/button[2]/span')
    def que(self):
        self.click(self.loc_que)
    loc_shu=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/form/div[1]/div/div/div/input')
    def shu(self):
        self.send_keys(self.loc_shu,'文科')
    loc_sou=(By.XPATH,'/html/body/div[1]/div/section/section/main/div[1]/form/div[2]/div[1]/div/div/button')
    def sou(self):
        self.click(self.loc_sou)



    def luoji_sou(self,username,password):
        self.open_url('http://localhost:8080/yklogin3')
        self.username(username)
        self.password(password)
        self.login()
        self.que()
        time.sleep(2)
        self.shu()
        self.sou()